﻿<FluentButton Appearance="@Appearance"
              Disabled="Disabled"
              Title="@(Value is true ? CheckedTitle : UncheckedTitle)"
              aria-label="@(Value is true ? CheckedTitle : UncheckedTitle)"
              OnClick="@(() => OnToggleInternalAsync())"
              IconEnd="@(Value is true ? CheckedIcon : UncheckedIcon)"
              @attributes="AdditionalAttributes" />

@code {
    [Parameter, EditorRequired]
    public required Appearance Appearance { get; set; }

    [Parameter]
    public bool Disabled { get; set; }

    [Parameter, EditorRequired]
    public required Icon CheckedIcon { get; set; }

    [Parameter, EditorRequired]
    public required Icon UncheckedIcon { get; set; }

    [Parameter, EditorRequired]
    public required string CheckedTitle { get; set; }

    [Parameter, EditorRequired]
    public required string UncheckedTitle { get; set; }

    [Parameter]
    public bool? Value { get; set; }

    [Parameter]
    public EventCallback<bool> ValueChanged { get; set; }

    [Parameter]
    public EventCallback OnToggle { get; set; }

    [Parameter(CaptureUnmatchedValues = true)]
    public IReadOnlyDictionary<string, object>? AdditionalAttributes { get; set; }
}
